home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / biblio / bibtex / contrib / annotation.bst (.txt) < prev    next >
LaTeX Document  |  1992-07-19  |  19KB  |  883 lines

  1. % BibTeX standard bibliography style `plain'
  2.     % version 0.99a for BibTeX versions 0.99a or later, LaTeX version 2.09.
  3.     % Copyright (C) 1985, all rights reserved.
  4.     % Copying of this file is authorized only if either
  5.     % (1) you make absolutely no changes to your copy, including name, or
  6.     % (2) if you do make changes, you name it something other than
  7.     % btxbst.doc, plain.bst, unsrt.bst, alpha.bst, and abbrv.bst.
  8.     % This restriction helps ensure that all standard styles are identical.
  9.     % The file btxbst.doc has the documentation for this style.
  10. ENTRY
  11.   { address
  12.     annote
  13.     author
  14.     booktitle
  15.     chapter
  16.     edition
  17.     editor
  18.     howpublished
  19.     institution
  20.     journal
  21.     key
  22.     month
  23.     note
  24.     number
  25.     organization
  26.     pages
  27.     publisher
  28.     school
  29.     series
  30.     title
  31.     type
  32.     volume
  33.     year
  34.   { label }
  35. INTEGERS { output.state before.all mid.sentence after.sentence after.block }
  36. FUNCTION {init.state.consts}
  37. { #0 'before.all :=
  38.   #1 'mid.sentence :=
  39.   #2 'after.sentence :=
  40.   #3 'after.block :=
  41. STRINGS { s t }
  42. FUNCTION {output.nonnull}
  43. { 's :=
  44.   output.state mid.sentence =
  45.     { ", " * write$ }
  46.     { output.state after.block =
  47.     { add.period$ write$
  48.       newline$
  49.       "\newblock " write$
  50.     { output.state before.all =
  51.         'write$
  52.         { add.period$ " " * write$ }
  53.       if$
  54.       if$
  55.       mid.sentence 'output.state :=
  56.     }
  57.   if$
  58. FUNCTION {output}
  59. { duplicate$ empty$
  60.     'pop$
  61.     'output.nonnull
  62.   if$
  63. FUNCTION {output.check}
  64. { 't :=
  65.   duplicate$ empty$
  66.     { pop$ "empty " t * " in " * cite$ * warning$ }
  67.     'output.nonnull
  68.   if$
  69. FUNCTION {output.bibitem}
  70. { newline$
  71.   "\bibitem{" write$
  72.   cite$ write$
  73.   "}" write$
  74.   newline$
  75.   before.all 'output.state :=
  76. FUNCTION {fin.entry}
  77. { add.period$
  78.   write$
  79.   newline$
  80.   "\begin{quotation}\noindent{\sc Key:\ }" cite$ * write$
  81.   annote missing$
  82.     'skip$
  83.     { "\\{\sc Annotation:\ }" write$  annote  write$ }
  84.   if$
  85.   "\end{quotation}" write$
  86.   newline$
  87. FUNCTION {new.block}
  88. { output.state before.all =
  89.     'skip$
  90.     { after.block 'output.state := }
  91.   if$
  92. FUNCTION {new.sentence}
  93. { output.state after.block =
  94.     'skip$
  95.     { output.state before.all =
  96.     'skip$
  97.     { after.sentence 'output.state := }
  98.       if$
  99.     }
  100.   if$
  101. FUNCTION {not}
  102. {   { #0 }
  103.     { #1 }
  104.   if$
  105. FUNCTION {and}
  106. {   'skip$
  107.     { pop$ #0 }
  108.   if$
  109. FUNCTION {or}
  110. {   { pop$ #1 }
  111.     'skip$
  112.   if$
  113. FUNCTION {new.block.checka}
  114. { empty$
  115.     'skip$
  116.     'new.block
  117.   if$
  118. FUNCTION {new.block.checkb}
  119. { empty$
  120.   swap$ empty$
  121.   and
  122.     'skip$
  123.     'new.block
  124.   if$
  125. FUNCTION {new.sentence.checka}
  126. { empty$
  127.     'skip$
  128.     'new.sentence
  129.   if$
  130. FUNCTION {new.sentence.checkb}
  131. { empty$
  132.   swap$ empty$
  133.   and
  134.     'skip$
  135.     'new.sentence
  136.   if$
  137. FUNCTION {field.or.null}
  138. { duplicate$ empty$
  139.     { pop$ "" }
  140.     'skip$
  141.   if$
  142. FUNCTION {emphasize}
  143. { duplicate$ empty$
  144.     { pop$ "" }
  145.     { "{\em " swap$ * "}" * }
  146.   if$
  147. INTEGERS { nameptr namesleft numnames }
  148. FUNCTION {format.names}
  149. { 's :=
  150.   #1 'nameptr :=
  151.   s num.names$ 'numnames :=
  152.   numnames 'namesleft :=
  153.     { namesleft #0 > }
  154.     { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't :=
  155.       nameptr #1 >
  156.     { namesleft #1 >
  157.         { ", " * t * }
  158.         { numnames #2 >
  159.         { "," * }
  160.         'skip$
  161.           if$
  162.           t "others" =
  163.         { " et~al." * }
  164.         { " and " * t * }
  165.           if$
  166.         }
  167.       if$
  168.       if$
  169.       nameptr #1 + 'nameptr :=
  170.       namesleft #1 - 'namesleft :=
  171.     }
  172.   while$
  173. FUNCTION {format.authors}
  174. { author empty$
  175.     { "" }
  176.     { author format.names }
  177.   if$
  178. FUNCTION {format.editors}
  179. { editor empty$
  180.     { "" }
  181.     { editor format.names
  182.       editor num.names$ #1 >
  183.     { ", editors" * }
  184.     { ", editor" * }
  185.       if$
  186.     }
  187.   if$
  188. FUNCTION {format.title}
  189. { title empty$
  190.     { "" }
  191.     { title "t" change.case$ }
  192.   if$
  193. FUNCTION {n.dashify}
  194. { 't :=
  195.     { t empty$ not }
  196.     { t #1 #1 substring$ "-" =
  197.     { t #1 #2 substring$ "--" = not
  198.         { "--" *
  199.           t #2 global.max$ substring$ 't :=
  200.         }
  201.         {   { t #1 #1 substring$ "-" = }
  202.         { "-" *
  203.           t #2 global.max$ substring$ 't :=
  204.           while$
  205.         }
  206.       if$
  207.     { t #1 #1 substring$ *
  208.       t #2 global.max$ substring$ 't :=
  209.       if$
  210.     }
  211.   while$
  212. FUNCTION {format.date}
  213. { year empty$
  214.     { month empty$
  215.     { "" }
  216.     { "there's a month but no year in " cite$ * warning$
  217.       month
  218.       if$
  219.     }
  220.     { month empty$
  221.     'year
  222.     { month " " * year * }
  223.       if$
  224.     }
  225.   if$
  226. FUNCTION {format.btitle}
  227. { title emphasize
  228. FUNCTION {tie.or.space.connect}
  229. { duplicate$ text.length$ #3 <
  230.     { "~" }
  231.     { " " }
  232.   if$
  233.   swap$ * *
  234. FUNCTION {either.or.check}
  235. { empty$
  236.     'pop$
  237.     { "can't use both " swap$ * " fields in " * cite$ * warning$ }
  238.   if$
  239. FUNCTION {format.bvolume}
  240. { volume empty$
  241.     { "" }
  242.     { "volume" volume tie.or.space.connect
  243.       series empty$
  244.     'skip$
  245.     { " of " * series emphasize * }
  246.       if$
  247.       "volume and number" number either.or.check
  248.     }
  249.   if$
  250. FUNCTION {format.number.series}
  251. { volume empty$
  252.     { number empty$
  253.     { series field.or.null }
  254.     { output.state mid.sentence =
  255.         { "number" }
  256.         { "Number" }
  257.       if$
  258.       number tie.or.space.connect
  259.       series empty$
  260.         { "there's a number but no series in " cite$ * warning$ }
  261.         { " in " * series * }
  262.       if$
  263.       if$
  264.     }
  265.     { "" }
  266.   if$
  267. FUNCTION {format.edition}
  268. { edition empty$
  269.     { "" }
  270.     { output.state mid.sentence =
  271.     { edition "l" change.case$ " edition" * }
  272.     { edition "t" change.case$ " edition" * }
  273.       if$
  274.     }
  275.   if$
  276. INTEGERS { multiresult }
  277. FUNCTION {multi.page.check}
  278. { 't :=
  279.   #0 'multiresult :=
  280.     { multiresult not
  281.       t empty$ not
  282.       and
  283.     }
  284.     { t #1 #1 substring$
  285.       duplicate$ "-" =
  286.       swap$ duplicate$ "," =
  287.       swap$ "+" =
  288.       or or
  289.     { #1 'multiresult := }
  290.     { t #2 global.max$ substring$ 't := }
  291.       if$
  292.     }
  293.   while$
  294.   multiresult
  295. FUNCTION {format.pages}
  296. { pages empty$
  297.     { "" }
  298.     { pages multi.page.check
  299.     { "pages" pages n.dashify tie.or.space.connect }
  300.     { "page" pages tie.or.space.connect }
  301.       if$
  302.     }
  303.   if$
  304. FUNCTION {format.vol.num.pages}
  305. { volume field.or.null
  306.   number empty$
  307.     'skip$
  308.     { "(" number * ")" * *
  309.       volume empty$
  310.     { "there's a number but no volume in " cite$ * warning$ }
  311.     'skip$
  312.       if$
  313.     }
  314.   if$
  315.   pages empty$
  316.     'skip$
  317.     { duplicate$ empty$
  318.     { pop$ format.pages }
  319.     { ":" * pages n.dashify * }
  320.       if$
  321.     }
  322.   if$
  323. FUNCTION {format.chapter.pages}
  324. { chapter empty$
  325.     'format.pages
  326.     { type empty$
  327.     { "chapter" }
  328.     { type "l" change.case$ }
  329.       if$
  330.       chapter tie.or.space.connect
  331.       pages empty$
  332.     'skip$
  333.     { ", " * format.pages * }
  334.       if$
  335.     }
  336.   if$
  337. FUNCTION {format.in.ed.booktitle}
  338. { booktitle empty$
  339.     { "" }
  340.     { editor empty$
  341.     { "In " booktitle emphasize * }
  342.     { "In " format.editors * ", " * booktitle emphasize * }
  343.       if$
  344.     }
  345.   if$
  346. FUNCTION {empty.misc.check}
  347. { author empty$ title empty$ howpublished empty$
  348.   month empty$ year empty$ note empty$
  349.   and and and and and
  350.   key empty$ not and
  351.     { "all relevant fields are empty in " cite$ * warning$ }
  352.     'skip$
  353.   if$
  354. FUNCTION {format.thesis.type}
  355. { type empty$
  356.     'skip$
  357.     { pop$
  358.       type "t" change.case$
  359.     }
  360.   if$
  361. FUNCTION {format.tr.number}
  362. { type empty$
  363.     { "Technical Report" }
  364.     'type
  365.   if$
  366.   number empty$
  367.     { "t" change.case$ }
  368.     { number tie.or.space.connect }
  369.   if$
  370. FUNCTION {format.article.crossref}
  371. { key empty$
  372.     { journal empty$
  373.     { "need key or journal for " cite$ * " to crossref " * crossref *
  374.       warning$
  375.       ""
  376.     { "In {\em " journal * "\/}" * }
  377.       if$
  378.     }
  379.     { "In " key * }
  380.   if$
  381.   " \cite{" * crossref * "}" *
  382. FUNCTION {format.crossref.editor}
  383. { editor #1 "{vv~}{ll}" format.name$
  384.   editor num.names$ duplicate$
  385.   #2 >
  386.     { pop$ " et~al." * }
  387.     { #2 <
  388.     'skip$
  389.     { editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
  390.         { " et~al." * }
  391.         { " and " * editor #2 "{vv~}{ll}" format.name$ * }
  392.       if$
  393.       if$
  394.     }
  395.   if$
  396. FUNCTION {format.book.crossref}
  397. { volume empty$
  398.     { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
  399.       "In "
  400.     }
  401.     { "Volume" volume tie.or.space.connect
  402.       " of " *
  403.     }
  404.   if$
  405.   editor empty$
  406.   editor field.or.null author field.or.null =
  407.     { key empty$
  408.     { series empty$
  409.         { "need editor, key, or series for " cite$ * " to crossref " *
  410.           crossref * warning$
  411.           "" *
  412.         }
  413.         { "{\em " * series * "\/}" * }
  414.       if$
  415.     { key * }
  416.       if$
  417.     }
  418.     { format.crossref.editor * }
  419.   if$
  420.   " \cite{" * crossref * "}" *
  421. FUNCTION {format.incoll.inproc.crossref}
  422. { editor empty$
  423.   editor field.or.null author field.or.null =
  424.     { key empty$
  425.     { booktitle empty$
  426.         { "need editor, key, or booktitle for " cite$ * " to crossref " *
  427.           crossref * warning$
  428.           ""
  429.         }
  430.         { "In {\em " booktitle * "\/}" * }
  431.       if$
  432.     { "In " key * }
  433.       if$
  434.     }
  435.     { "In " format.crossref.editor * }
  436.   if$
  437.   " \cite{" * crossref * "}" *
  438. FUNCTION {article}
  439. { output.bibitem
  440.   format.authors "author" output.check
  441.   new.block
  442.   format.title "title" output.check
  443.   new.block
  444.   crossref missing$
  445.     { journal emphasize "journal" output.check
  446.       format.vol.num.pages output
  447.       format.date "year" output.check
  448.     }
  449.     { format.article.crossref output.nonnull
  450.       format.pages output
  451.     }
  452.   if$
  453.   new.block
  454.   note output
  455.   fin.entry
  456. FUNCTION {book}
  457. { output.bibitem
  458.   author empty$
  459.     { format.editors "author and editor" output.check }
  460.     { format.authors output.nonnull
  461.       crossref missing$
  462.     { "author and editor" editor either.or.check }
  463.     'skip$
  464.       if$
  465.     }
  466.   if$
  467.   new.block
  468.   format.btitle "title" output.check
  469.   crossref missing$
  470.     { format.bvolume output
  471.       new.block
  472.       format.number.series output
  473.       new.sentence
  474.       publisher "publisher" output.check
  475.       address output
  476.     }
  477.     { new.block
  478.       format.book.crossref output.nonnull
  479.     }
  480.   if$
  481.   format.edition output
  482.   format.date "year" output.check
  483.   new.block
  484.   note output
  485.   fin.entry
  486. FUNCTION {booklet}
  487. { output.bibitem
  488.   format.authors output
  489.   new.block
  490.   format.title "title" output.check
  491.   howpublished address new.block.checkb
  492.   howpublished output
  493.   address output
  494.   format.date output
  495.   new.block
  496.   note output
  497.   fin.entry
  498. FUNCTION {inbook}
  499. { output.bibitem
  500.   author empty$
  501.     { format.editors "author and editor" output.check }
  502.     { format.authors output.nonnull
  503.       crossref missing$
  504.     { "author and editor" editor either.or.check }
  505.     'skip$
  506.       if$
  507.     }
  508.   if$
  509.   new.block
  510.   format.btitle "title" output.check
  511.   crossref missing$
  512.     { format.bvolume output
  513.       format.chapter.pages "chapter and pages" output.check
  514.       new.block
  515.       format.number.series output
  516.       new.sentence
  517.       publisher "publisher" output.check
  518.       address output
  519.     }
  520.     { format.chapter.pages "chapter and pages" output.check
  521.       new.block
  522.       format.book.crossref output.nonnull
  523.     }
  524.   if$
  525.   format.edition output
  526.   format.date "year" output.check
  527.   new.block
  528.   note output
  529.   fin.entry
  530. FUNCTION {incollection}
  531. { output.bibitem
  532.   format.authors "author" output.check
  533.   new.block
  534.   format.title "title" output.check
  535.   new.block
  536.   crossref missing$
  537.     { format.in.ed.booktitle "booktitle" output.check
  538.       format.bvolume output
  539.       format.number.series output
  540.       format.chapter.pages output
  541.       new.sentence
  542.       publisher "publisher" output.check
  543.       address output
  544.       format.edition output
  545.       format.date "year" output.check
  546.     }
  547.     { format.incoll.inproc.crossref output.nonnull
  548.       format.chapter.pages output
  549.     }
  550.   if$
  551.   new.block
  552.   note output
  553.   fin.entry
  554. FUNCTION {inproceedings}
  555. { output.bibitem
  556.   format.authors "author" output.check
  557.   new.block
  558.   format.title "title" output.check
  559.   new.block
  560.   crossref missing$
  561.     { format.in.ed.booktitle "booktitle" output.check
  562.       format.bvolume output
  563.       format.number.series output
  564.       format.pages output
  565.       address empty$
  566.     { organization publisher new.sentence.checkb
  567.       organization output
  568.       publisher output
  569.       format.date "year" output.check
  570.     { address output.nonnull
  571.       format.date "year" output.check
  572.       new.sentence
  573.       organization output
  574.       publisher output
  575.       if$
  576.     }
  577.     { format.incoll.inproc.crossref output.nonnull
  578.       format.pages output
  579.     }
  580.   if$
  581.   new.block
  582.   note output
  583.   fin.entry
  584. FUNCTION {conference} { inproceedings }
  585. FUNCTION {manual}
  586. { output.bibitem
  587.   author empty$
  588.     { organization empty$
  589.     'skip$
  590.     { organization output.nonnull
  591.       address output
  592.       if$
  593.     }
  594.     { format.authors output.nonnull }
  595.   if$
  596.   new.block
  597.   format.btitle "title" output.check
  598.   author empty$
  599.     { organization empty$
  600.     { address new.block.checka
  601.       address output
  602.     'skip$
  603.       if$
  604.     }
  605.     { organization address new.block.checkb
  606.       organization output
  607.       address output
  608.     }
  609.   if$
  610.   format.edition output
  611.   format.date output
  612.   new.block
  613.   note output
  614.   fin.entry
  615. FUNCTION {mastersthesis}
  616. { output.bibitem
  617.   format.authors "author" output.check
  618.   new.block
  619.   format.title "title" output.check
  620.   new.block
  621.   "Master's thesis" format.thesis.type output.nonnull
  622.   school "school" output.check
  623.   address output
  624.   format.date "year" output.check
  625.   new.block
  626.   note output
  627.   fin.entry
  628. FUNCTION {misc}
  629. { output.bibitem
  630.   format.authors output
  631.   title howpublished new.block.checkb
  632.   format.title output
  633.   howpublished new.block.checka
  634.   howpublished output
  635.   format.date output
  636.   new.block
  637.   note output
  638.   fin.entry
  639.   empty.misc.check
  640. FUNCTION {phdthesis}
  641. { output.bibitem
  642.   format.authors "author" output.check
  643.   new.block
  644.   format.btitle "title" output.check
  645.   new.block
  646.   "PhD thesis" format.thesis.type output.nonnull
  647.   school "school" output.check
  648.   address output
  649.   format.date "year" output.check
  650.   new.block
  651.   note output
  652.   fin.entry
  653. FUNCTION {proceedings}
  654. { output.bibitem
  655.   editor empty$
  656.     { organization output }
  657.     { format.editors output.nonnull }
  658.   if$
  659.   new.block
  660.   format.btitle "title" output.check
  661.   format.bvolume output
  662.   format.number.series output
  663.   address empty$
  664.     { editor empty$
  665.     { publisher new.sentence.checka }
  666.     { organization publisher new.sentence.checkb
  667.       organization output
  668.       if$
  669.       publisher output
  670.       format.date "year" output.check
  671.     }
  672.     { address output.nonnull
  673.       format.date "year" output.check
  674.       new.sentence
  675.       editor empty$
  676.     'skip$
  677.     { organization output }
  678.       if$
  679.       publisher output
  680.     }
  681.   if$
  682.   new.block
  683.   note output
  684.   fin.entry
  685. FUNCTION {techreport}
  686. { output.bibitem
  687.   format.authors "author" output.check
  688.   new.block
  689.   format.title "title" output.check
  690.   new.block
  691.   format.tr.number output.nonnull
  692.   institution "institution" output.check
  693.   address output
  694.   format.date "year" output.check
  695.   new.block
  696.   note output
  697.   fin.entry
  698. FUNCTION {unpublished}
  699. { output.bibitem
  700.   format.authors "author" output.check
  701.   new.block
  702.   format.title "title" output.check
  703.   new.block
  704.   note "note" output.check
  705.   format.date output
  706.   fin.entry
  707. FUNCTION {default.type} { misc }
  708. MACRO {jan} {"January"}
  709. MACRO {feb} {"February"}
  710. MACRO {mar} {"March"}
  711. MACRO {apr} {"April"}
  712. MACRO {may} {"May"}
  713. MACRO {jun} {"June"}
  714. MACRO {jul} {"July"}
  715. MACRO {aug} {"August"}
  716. MACRO {sep} {"September"}
  717. MACRO {oct} {"October"}
  718. MACRO {nov} {"November"}
  719. MACRO {dec} {"December"}
  720. MACRO {acmcs} {"ACM Computing Surveys"}
  721. MACRO {acta} {"Acta Informatica"}
  722. MACRO {cacm} {"Communications of the ACM"}
  723. MACRO {ibmjrd} {"IBM Journal of Research and Development"}
  724. MACRO {ibmsj} {"IBM Systems Journal"}
  725. MACRO {ieeese} {"IEEE Transactions on Software Engineering"}
  726. MACRO {ieeetc} {"IEEE Transactions on Computers"}
  727. MACRO {ieeetcad}
  728.  {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
  729. MACRO {ipl} {"Information Processing Letters"}
  730. MACRO {jacm} {"Journal of the ACM"}
  731. MACRO {jcss} {"Journal of Computer and System Sciences"}
  732. MACRO {scp} {"Science of Computer Programming"}
  733. MACRO {sicomp} {"SIAM Journal on Computing"}
  734. MACRO {tocs} {"ACM Transactions on Computer Systems"}
  735. MACRO {tods} {"ACM Transactions on Database Systems"}
  736. MACRO {tog} {"ACM Transactions on Graphics"}
  737. MACRO {toms} {"ACM Transactions on Mathematical Software"}
  738. MACRO {toois} {"ACM Transactions on Office Information Systems"}
  739. MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}
  740. MACRO {tcs} {"Theoretical Computer Science"}
  741. FUNCTION {sortify}
  742. { purify$
  743.   "l" change.case$
  744. INTEGERS { len }
  745. FUNCTION {chop.word}
  746. { 's :=
  747.   'len :=
  748.   s #1 len substring$ =
  749.     { s len #1 + global.max$ substring$ }
  750.     's
  751.   if$
  752. FUNCTION {sort.format.names}
  753. { 's :=
  754.   #1 'nameptr :=
  755.   s num.names$ 'numnames :=
  756.   numnames 'namesleft :=
  757.     { namesleft #0 > }
  758.     { nameptr #1 >
  759.     { "   " * }
  760.     'skip$
  761.       if$
  762.       s nameptr "{vv{ } }{ll{ }}{  ff{ }}{  jj{ }}" format.name$ 't :=
  763.       nameptr numnames = t "others" = and
  764.     { "et al" * }
  765.     { t sortify * }
  766.       if$
  767.       nameptr #1 + 'nameptr :=
  768.       namesleft #1 - 'namesleft :=
  769.     }
  770.   while$
  771. FUNCTION {sort.format.title}
  772. { 't :=
  773.   "A " #2
  774.     "An " #3
  775.       "The " #4 t chop.word
  776.     chop.word
  777.   chop.word
  778.   sortify
  779.   #1 global.max$ substring$
  780. FUNCTION {author.sort}
  781. { author empty$
  782.     { key empty$
  783.     { "to sort, need author or key in " cite$ * warning$
  784.       ""
  785.     { key sortify }
  786.       if$
  787.     }
  788.     { author sort.format.names }
  789.   if$
  790. FUNCTION {author.editor.sort}
  791. { author empty$
  792.     { editor empty$
  793.     { key empty$
  794.         { "to sort, need author, editor, or key in " cite$ * warning$
  795.           ""
  796.         }
  797.         { key sortify }
  798.       if$
  799.     { editor sort.format.names }
  800.       if$
  801.     }
  802.     { author sort.format.names }
  803.   if$
  804. FUNCTION {author.organization.sort}
  805. { author empty$
  806.     { organization empty$
  807.     { key empty$
  808.         { "to sort, need author, organization, or key in " cite$ * warning$
  809.           ""
  810.         }
  811.         { key sortify }
  812.       if$
  813.     { "The " #4 organization chop.word sortify }
  814.       if$
  815.     }
  816.     { author sort.format.names }
  817.   if$
  818. FUNCTION {editor.organization.sort}
  819. { editor empty$
  820.     { organization empty$
  821.     { key empty$
  822.         { "to sort, need editor, organization, or key in " cite$ * warning$
  823.           ""
  824.         }
  825.         { key sortify }
  826.       if$
  827.     { "The " #4 organization chop.word sortify }
  828.       if$
  829.     }
  830.     { editor sort.format.names }
  831.   if$
  832. FUNCTION {presort}
  833. { type$ "book" =
  834.   type$ "inbook" =
  835.     'author.editor.sort
  836.     { type$ "proceedings" =
  837.     'editor.organization.sort
  838.     { type$ "manual" =
  839.         'author.organization.sort
  840.         'author.sort
  841.       if$
  842.       if$
  843.     }
  844.   if$
  845.   "    "
  846.   year field.or.null sortify
  847.   "    "
  848.   title field.or.null
  849.   sort.format.title
  850.   #1 entry.max$ substring$
  851.   'sort.key$ :=
  852. ITERATE {presort}
  853. STRINGS { longest.label }
  854. INTEGERS { number.label longest.label.width }
  855. FUNCTION {initialize.longest.label}
  856. { "" 'longest.label :=
  857.   #1 'number.label :=
  858.   #0 'longest.label.width :=
  859. FUNCTION {longest.label.pass}
  860. { number.label int.to.str$ 'label :=
  861.   number.label #1 + 'number.label :=
  862.   label width$ longest.label.width >
  863.     { label 'longest.label :=
  864.       label width$ 'longest.label.width :=
  865.     }
  866.     'skip$
  867.   if$
  868. EXECUTE {initialize.longest.label}
  869. ITERATE {longest.label.pass}
  870. FUNCTION {begin.bib}
  871. { preamble$ empty$
  872.     'skip$
  873.     { preamble$ write$ newline$ }
  874.   if$
  875.   "\begin{thebibliography}{"  longest.label  * "}" * write$ newline$
  876. EXECUTE {begin.bib}
  877. EXECUTE {init.state.consts}
  878. ITERATE {call.type$}
  879. FUNCTION {end.bib}
  880. { newline$
  881.   "\end{thebibliography}" write$ newline$
  882. EXECUTE {end.bib}
  883.